package com.wordpress.standal.multimethod.examples.animals

import com.wordpress.standal.multimethod.api.class2.MultiMethod

object Encounter {
  
  def main(args : Array[String]) : Unit = {
    
    val encounter = MultiMethod[Animal, Animal, String]
    
    encounter.add(classOf[Bunny], classOf[Lion], (b: Bunny, l: Lion) => "run away")
    encounter.add(classOf[Lion], classOf[Bunny], (l: Lion, b: Bunny) => "eat")
    encounter.add(classOf[Lion], classOf[Lion], (l1: Lion, l2: Lion) => "fight")
    encounter.add(classOf[Bunny], classOf[Bunny], (b1: Bunny, b2: Bunny) => "mate")
    
    val b1 = new Bunny
    val b2 = new Bunny
    val l1 = new Lion
    val l2 = new Lion
    
    
    println(encounter(b1, b2))
    println(encounter(b1, l1))
    println(encounter(l1, b1))
    println(encounter(l1, l2))
    
    
  }

}

